Xbasic

UI_BITMAP_INFO_GET Function

IN THIS PAGE

Syntax

c type = UI_BITMAP_INFO_GET(B bitmap_data,C format)

Arguments

bitmap_data

The name of a blob variable containing bitmap data.

format

Character Parameter; "w" = width in pixels, "h" = height in pixels, "b" = bits per pixel, "t" = image type

Description

Returns information about a bitmap formats: w=width h=height b=bits-per-pixel.

Discussion

The UI_BITMAP_INFO_GET() function returns information about a bitmap blob variable.

Example

put description here

dim b1 as B
ui_bitmap_create_from_screen("test", 0, 0, 4, 1)
b1 = ui_bitmap_save("test")
? ui_bitmap_info_get(b1,"w")
= "384"

These examples show how to use the "b" flag to get color depth 'Read the image into a blob and then convert from jpg to bmp

pic = "c:\images\8bit.jpg" 
b1 = jpeg_to_bitmap(file.to_blob(pic))
?ui_bitmap_info_get(b1,"b")
= "8"
dim b1 as B
dim pic as c
pic = "c:\images\8bit.jpg" 'image is an 8 bit grayscale photo
b1 = ui_bitmap_save(pic)

Notice that once the blob is loaded into an in-memory bitmap (using the ui_bitmap_save()) function'it always has a color depth of 24. This is because the ui_bitmap_save() function uses the screen device context'and it translates the image to the display's supported color depth.

?ui_bitmap_info_get(b1,"b")
= "24"

Image Type

ui_bitmap_info_get() can return the image type of image binary data. For exmample with the syntax:

c type = ui_bitmap_info_get(b blobImageData,"T")

Example

dim b as b 
b = file.to_blob("c:\images\image1.jpg")
? ui_bitmap_info_get(b,"T")
= "JPG"

Limitations

See Also